﻿<common:LayoutAwarePage
    x:Name="pageRoot"
    x:Class="ShamsiCalendar.MainPage"
    DataContext="{Binding DefaultViewModel, RelativeSource={RelativeSource Self}}"
    IsTabStop="false"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:ShamsiCalendar"
    xmlns:common="using:ShamsiCalendar.Common"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Page.Resources>

        <!-- TODO: Delete this line if the key AppName is declared in App.xaml -->
        <x:String x:Key="AppName">Shamsi Calendar</x:String>
    </Page.Resources>

    <!--
        This grid acts as a root panel for the page that defines two rows:
        * Row 0 contains the back button and page title
        * Row 1 contains the rest of the page layout
    -->
    <Grid Style="{StaticResource LayoutRootStyle}">
        <Grid.RowDefinitions>
            <RowDefinition Height="140"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!-- Back button and page title -->
        <Grid Background="{StaticResource AppBarBackgroundThemeBrush}">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Button x:Name="backButton" Click="GoBack" IsEnabled="{Binding Frame.CanGoBack, ElementName=pageRoot}" Style="{StaticResource BackButtonStyle}"/>
            <TextBlock x:Name="txtVersion" Grid.Column="1" HorizontalAlignment="Left" Margin="1074,117,0,0" TextWrapping="Wrap" Text="Version: 1.0.0.1" VerticalAlignment="Top"/>
            <TextBlock x:Name="pageTitle" Grid.Column="1" Text="Iranian (Shmasi) Calendar" Style="{StaticResource PageHeaderTextStyle}"/>
        </Grid>
        <StackPanel HorizontalAlignment="Center" Height="557" Margin="0" Grid.Row="1" VerticalAlignment="Center" Width="500" Background="Black">
            <TextBlock x:Name="lblDayStr" HorizontalAlignment="Center" TextWrapping="Wrap" Text="shanbeh" Width="500" TextAlignment="Center" FontSize="88" Margin="-1,0,1,0" Height="99"/>
            <TextBlock x:Name="lblDay" HorizontalAlignment="Left" TextWrapping="Wrap" Text="22" FontSize="222" Height="255" VerticalAlignment="Center" TextAlignment="Center" Margin="0,0,99,0" Width="500">
                <TextBlock.Foreground>
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="#FFFF8102"/>
                        <GradientStop Color="#FFD1FF00" Offset="1"/>
                    </LinearGradientBrush>
                </TextBlock.Foreground>
            </TextBlock>
            <TextBlock x:Name="lblMount" HorizontalAlignment="Center" TextWrapping="Wrap" Text="Mehr" Width="500" TextAlignment="Center" FontSize="88" Margin="0,0,2,0" Height="104"/>
            <TextBlock x:Name="lblYear" HorizontalAlignment="Center" TextWrapping="Wrap" Text="1391" Width="500" TextAlignment="Center" FontSize="88" Margin="0,0,2,0" Height="99"/>
        </StackPanel>

        <VisualStateManager.VisualStateGroups>

            <!-- Visual states reflect the application's view state -->
            <VisualStateGroup x:Name="ApplicationViewStates">
                <VisualState x:Name="FullScreenLandscape"/>
                <VisualState x:Name="Filled"/>

                <!-- The entire page respects the narrower 100-pixel margin convention for portrait -->
                <VisualState x:Name="FullScreenPortrait">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="backButton" Storyboard.TargetProperty="Style">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PortraitBackButtonStyle}"/>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>

                <!-- The back button and title have different styles when snapped -->
                <VisualState x:Name="Snapped">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="backButton" Storyboard.TargetProperty="Style">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SnappedBackButtonStyle}"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="pageTitle" Storyboard.TargetProperty="Style">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SnappedPageHeaderTextStyle}"/>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
    </Grid>
</common:LayoutAwarePage>
